<template>
    <div class="page-balance">
        <van-nav-bar
                :fixed="fixed"
                title="签到查询"
                left-text="返回"
                left-arrow
                @click-left="onClickLeft"
        />
        <div v-if="list==''" class="user-list">
            您当前还没有任何记录~~~~~~
        </div>
        <div v-if="list!=''">
            <van-cell-group :style="{marginTop:'46px'}">
                <!--:value="'第'+item.days+'天'"-->
                <van-cell title="签到成功"  :label=formatTime(item.create_time) v-for="item in list"/>
            </van-cell-group>
        </div>
    </div>
</template>

<script>
    import {SignQuery} from "../api/data";
    export default {
        data() {
            return {
                fixed:true,
                list: [null],
            }
        },
        methods: {
            onClickLeft() {
                this.$router.back()
            },
            formatTime(time) {
                let createDate = new Date();
                createDate.setTime(time * 1000);
                return createDate.format('yyyy-MM-dd hh:mm');
            },
        },
        created() {//页面加载执行函数
            SignQuery().then(res => {//签到查询
                if (res.data.code == '10001') {
                    Toast('登录已失效，请重新登录！')
                    this.$router.push({path:`/login`})
                    localStorage.removeItem('token')
                    return
                }
                this.list = res.data.data
            })
        }
    };
</script>
<style>
    .page-balance .van-cell__value {
        padding-top: 10px;
    }
</style>
<style scoped>
    .card-goods {
        margin-top: 46px;
        padding: 10px 0;
        background-color: #fff;
    }

    .user-list {
        margin-top: 47px;
        height: 200px;
        line-height: 200px;
        text-align: center;
        font-size: 14px;
    }
</style>
